<?php
# 文件名称:grid.php
# MetInfo在线反馈系统 
# Copyright (C) 长沙米拓信息技术有限公司 (http://www.metinfo.cn). All rights reserved.
defined( '_SYS' ) or die( 'No direct script access allowed' );
class C_htmlGrid
{
	function sort( $title, $order, $direction = 'asc', $selected = 0, $task=NULL )
	{
		$SYS = &get_instance();
		$direction	= strtolower( $direction );
		$images		= array( 'sort_asc.png', 'sort_desc.png' );
		$index		= intval( $direction == 'desc' );
		$direction	= ($direction == 'desc') ? 'asc' : 'desc';
		$html = '<a href="javascript:tableOrdering(\''.$order.'\',\''.$direction.'\',\''.$task.'\');" title="'.C_text::_( 'Tip4' ).'">';
		$html .= C_text::_( $title );
		if ($order == $selected ) {
			$html .= '<img src="'.WEBURL.'/templates/'.$SYS->config->item('theme').'/images/'.$images[$index].'" alt=""  />';
		}
		$html .= '</a>';
		return $html;
	}
	function id( $rowNum, $recId, $checkedOut=false )
	{
		if ( $checkedOut ) {
			return '';
		} else {
			return '<input type="checkbox" id=cb'.$rowNum.' class="cb" name=cid[] value="'.$recId.'" onclick="isChecked(this.checked);" />';
		}
	}
	function access( &$row, $i, $archived = NULL )
	{
		if ( !$row->access )  {
			$color_access = 'style="color: green;"';
			$task_access = 'accessregistered';
		} else if ( $row->access == 1 ) {
			$color_access = 'style="color: red;"';
			$task_access = 'accessspecial';
		} else {
			$color_access = 'style="color: black;"';
			$task_access = 'accesspublic';
		}
		if ($archived == -1)
		{
			$href = C_text::_( $row->groupname );
		}
		else
		{
			$href = '
			<a href="javascript:void(0);" onclick="return listItemTask(\'cb'. $i .'\',\''. $task_access .'\')" '. $color_access .'>
			'. C_text::_( $row->groupname ) .'</a>'
			;
		}
		return $href;
	}
}
# 本程序是一个开源系统,使用时请你仔细阅读使用协议,商业用途请自觉购买商业授权.
# Copyright (C) 长沙米拓信息技术有限公司 (http://www.metinfo.cn). All rights reserved.
?>